@(issue: gitbucket.core.model.Issue,
  pullreq: gitbucket.core.model.PullRequest,
  commits: Seq[gitbucket.core.util.JGitUtil.CommitInfo],
  comments: Seq[gitbucket.core.model.Comment],
  changedFileSize: Int,
  issueLabels: List[gitbucket.core.model.Label],
  issueAssignees: List[gitbucket.core.model.IssueAssignee],
  collaborators: List[String],
  milestones: List[(gitbucket.core.model.Milestone, Int, Int)],
  priorities: List[gitbucket.core.model.Priority],
  labels: List[gitbucket.core.model.Label],
  customFields: List[(gitbucket.core.model.CustomField, Option[gitbucket.core.model.IssueCustomField])],
  isEditable: Boolean,
  isManageable: Boolean,
  isManageableForkedRepository: Boolean,
  repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
  forkedRepository: Option[gitbucket.core.service.RepositoryService.RepositoryInfo],
  flash: Map[String, String])(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
@gitbucket.core.pulls.html.menu("conversation", issue, pullreq, commits, comments, changedFileSize, isManageable, repository, flash){
  <link href="@helpers.assets("/vendors/jsdifflib/diffview.css")" type="text/css" rel="stylesheet" />
  <div class="col-md-9">
    <div id="comment-list">
      @gitbucket.core.issues.html.commentlist(Some(issue), comments.toList, isManageable, repository, Some(pullreq))
    </div>
    @defining(comments.flatMap {
      case comment: gitbucket.core.model.IssueComment => Some(comment)
      case other => None
    }.exists(_.action == "merge")){ merged =>
      @if(!issue.closed){
        <div class="check-conflict" style="display: none; margin-bottom: 20px;">
          <div class="issue-comment-box" style="background-color: #fbeed5">
            <div class="box-content" style="border: 1px solid #c09853; padding: 10px;">
              <img src="@helpers.assets("/common/images/indicator.gif")"/> Checking...
            </div>
          </div>
        </div>
      }
      @if(isManageableForkedRepository && issue.closed && merged &&
        forkedRepository.map(r => (r.branchList.contains(pullreq.requestBranch) && r.repository.defaultBranch != pullreq.requestBranch)).getOrElse(false)){
        <div class="issue-comment-box" style="background-color: #d0eeff;">
          <div class="box-content" style="border: 1px solid #87a8c9; padding: 10px;">
            <a href="@helpers.url(repository)/pull/@issue.issueId/delete_branch" class="btn btn-info pull-right delete-branch" data-name="@pullreq.requestBranch">Delete branch</a>
            <div>
              <span class="strong">Pull request successfully merged and closed</span>
            </div>
            <span class="small muted">You're all set. The <span class="label label-info monospace">@pullreq.requestBranch</span> branch can now be safely deleted.</span>
          </div>
        </div>
      }
      @gitbucket.core.issues.html.commentform(issue, !merged, isEditable, isManageable, repository)
    }
  </div>
  <div class="col-md-3">
    @gitbucket.core.issues.html.issueinfo(
      Some(issue),
      comments.toList,
      issueLabels,
      issueAssignees,
      collaborators,
      milestones,
      priorities,
      None,
      labels,
      customFields,
      isManageable,
      repository
    )
  </div>
  <script>
  $(function(){
    @if(commits.nonEmpty){
      const checkConflict = $('.check-conflict').show();
      if(checkConflict.length){
        $.get('@helpers.url(repository)/pull/@issue.issueId/mergeguide', function(data){ $('.check-conflict').html(data); });
      }
    }
    $('.delete-branch').click(function(e){
      const branchName = $(e.target).data('name');
      return confirm('Are you sure you want to remove the ' + branchName + ' branch?');
    });
  });
  </script>
}
